project( OutLib )

#用于生成位置无关的代码,使代码在加载到内存时使用相对地址，所有对固定地址的访问都通过全局偏移表(GOT)来实现
add_compile_options(-fPIC)

#aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} src)
set( src
    ${CMAKE_CURRENT_SOURCE_DIR}/OutLibTest.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/OutLibTest.h
)

include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/../shareLibTest
)

set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/../build)
#STATIC是生成静态库，SHARED是生成动态库
#add_library ( ${PROJECT_NAME} STATIC ${src})
add_library ( ${PROJECT_NAME} SHARED ${src})

target_link_libraries(
    ${PROJECT_NAME}
    shareLibTest
)

add_definitions(-D OutLib_Export) #宏定义添加


#SET(BUILD_PLATFORM "x86" CACHE STRING "select build cpu type")
## 外部用cmake . -DBUILD_PLATFORM=arm进行值传入，便可以执行不同的逻辑
#if (BUILD_PLATFORM STREQUAL arm)
#  message("this is arm platform")
#  find_library(ActiveMQ_LIB activemq-cpp HINTS ${CMAKE_SOURCE_DIR}/../3rdParty/lib/arm/ActiveMq)
#  find_library(Apr_LIB apr-1 HINTS ${CMAKE_SOURCE_DIR}/../3rdParty/lib/arm/apr)
#else()
#  message("this is x86 platform")
#  find_library(ActiveMQ_LIB activemq-cpp HINTS ${CMAKE_SOURCE_DIR}/../3rdParty/lib/x86_linux/ActiveMq)
#  find_library(Apr_LIB apr-1 HINTS ${CMAKE_SOURCE_DIR}/../3rdParty/lib/x86_linux/apr)
#endif()

#单行注释：使用“#”
#多行注释：使用“#[[ ]]#”
#[[macro(OutLib_Export)
endmacro()]]

